/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chapter6;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Denise Carolina
 */
public class RegularExpressions {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Pattern p = Pattern.compile("ab");
//        p = Pattern.compile("aba");
//        p = Pattern.compile("\\d");
        p = Pattern.compile("0[xX]([0-9affA-F])+");

        Matcher m = p.matcher("abaaaba");
//        m = p.matcher("abababa");
//        m = p.matcher("a12c3456hj345lret12");
        m = p.matcher("12 0x 0x12 0Xf 0xg");
        while(m.find()){
            System.out.println("position:: " + m.start() + " what: " + m.group());
            
        }
    }

}
